#include<iostream>
#include<functional>
using namespace std;


// 让任务类型提供一些+-*\的接口
class Task
{
// typedef function<int(int, int)> fun_t; // 定义一个函数类型，返回值int，参数为(int, int)
using func_t = function<int(int, int, char)>; // 和上面那句话的功能是一样的
public:

    Task(){}
    Task(int x, int y, char op, func_t func)
    :_x(x)
    ,_y(y)
    ,_op(op)
    ,_callback(func)
    {}

    string operator()()
    {
        int result = _callback(_x, _y, _op);
        char buffer[64];
        snprintf(buffer, sizeof buffer, "%d %c %d = %d", _x, _op, _y, result);
        return buffer;
    }

    string toTackString()
    {
        char buffer[64];
        snprintf(buffer, sizeof buffer, "%d %c %d = ?", _x, _op, _y);
        return buffer;
    }

private:
    int _x;
    int _y;
    char _op; //存储选项
    func_t _callback;
};